<template>
  <div class="container-wrap">
    <div class="banner-wrap empty">
      <image src="../../static/image/live-banner.png" style="width:100%"/>
      <div class="text">近期没有直播</div>
    </div>
    <div class="list-wrap common-wrap">
      <div class="title-wrap flex-wrap flex-middle">
        <span class="fs-18 fc-333 fw-b flex-item">往期直播</span>
      </div>
      <van-list  :finished="listFinished" finished-text="没有更多了" @load="loadMore">
        <ListItem :list="list" mode="2" vertical></ListItem>
      </van-list>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import ListItem from '@/components/live/listItem.vue'
import vanList from "@/components/vant/van-list/van-list.vue"
import mockData from "@/mock/live/index.json"
export default {
   
  head() {
    return {
      title: this.title,
    }
  },
  data() {
    return {
      title: '直播课堂',
      list: [], // 课程列表
      listFinished: false,
      
    }
  },
  components: {
    ListItem,
	vanList
  },
  created() {
    this.getList()
  },
  methods: {
    onClickLeft() {
      uni.navigateBack({ delta: 1 })
    },
    toDetail(item) {
      this.$uniPush({
        name: 'live-detail-id',
        params: {
          id: item.courseId
        }
      })
    },
    getList(loadNew = false) {
      if (loadNew)return; 
	  this.list = this.list.concat(mockData.data.list || []);
      this.listFinished = true;
    },
    loadMore() {
      if (!this.listFinished) this.getList()
    },
  },
  onReachBottom(){
	  this.loadMore()
  }
}
</script>

<style lang="scss" scoped>
.container-wrap{
}
.banner-wrap.empty{
  position: relative;
  .text{
    position: absolute;
    width: 100%;
    top: calc(50% - 16px);
    left: 0;
    text-align: center;
    font-size: 20px;
    font-weight: 400;
    color: #666666;
    line-height: 32px;
    letter-spacing: 10px;
  }
  img{
    width: 100%;
  }
}
.top-wrap{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
}
.list-item {
  position: relative;
  img {
    margin-right: 10px;
    height: 63px;
  }
  .item-name {
    color: #333333;
    font-size: 14px;
    line-height: 20px;
    margin-top: 5px;
  }
  .item-status{
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: rgba(0, 0, 0, 0.3);
    font-size: 16px;
    color: #fff;
    .icon-data{
      background: #fff;
      &:after{
        background: #fff;
      }
      &:before{
        background: #fff;
      }
    }
  }
}
.van-swipe{
  padding: 20px 15px;
  .van-swipe-item{
    padding-right: 15px;
	width: 143px !important;
    &.active{
      .time-wrap{
        color: var(--color);
        background: var(--colorbg);
      }
      .number-wrap{
        .icon-circle{
          background: var(--color);
        }
      }
    }
    .time-wrap{
      width: 100%;
      height: 24px;
      font-size: 11px;
      font-weight: 400;
      color: #333333;
      line-height: 24px;
      background: #F3F3F3;
      border-radius: 16px;
      text-align: center;
    }
    .number-wrap{
      position: relative;
      height: 24px;
      z-index: 1;
      .icon-line{
        position: absolute;
        height: 1px;
        background: #EEEEEE;
        top: 50%;
        left: 0;
        right: -15px;
        z-index: -1;
      }
      .icon-circle{
        width: 4px;
        height: 4px;
        background: #999;
        border-radius: 2px;
      }
    }
  }
}
.item-default-img {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-right: 10px;
  background: url('/static/image/course-img.png') no-repeat;
  background-size: contain !important;
  .item-default-text {
    font-size: 12px;
    color: #fff;
    text-align: center;
    padding: 0 10px;
  }
  .abs-tip-price {
    position: absolute;
    right: 0;
    top: 20px;
    height: 20px;
    background: #F9563D;
    color: #fff;
    //border-radius: 0 8px 0 0;
    padding: 0 10px;
    line-height: 20px;
    flex-wrap: nowrap;
    .icon {
      transform:scale(0.8);
    }
  }
}
.list-wrap{
  padding: 15px;
  background: #F6F6F6;
  :deep(.list-wrapper){
    padding: 10px 0 4px;
  }
}
.icon-data{
  position: relative;
  display: inline-block;
  width: 2PX;
  height: 12px;
  background: var(--color);
  vertical-align: -1px;
  margin-right: 6PX;
  &:after{
    content: '';
    position: absolute;
    bottom: 0;
    right: -3PX;
    width: 2PX;
    height: 6px;
    background: var(--color);
  }
  &:before{
    content: '';
    position: absolute;
    bottom: 0;
    left: -3PX;
    width: 2PX;
    height: 8px;
    background: var(--color);
  }
}
</style>
